package com.neusoft.neu24.controller;

import com.neusoft.neu24.Result.CommonResult;
import com.neusoft.neu24.dto.Aqi2Screen;
import com.neusoft.neu24.dto.StatDTO;
import com.neusoft.neu24.entity.*;
import com.neusoft.neu24.service.impl.AirServiceImpl;
import com.neusoft.neu24.service.impl.StatisticsServiceImpl;
import com.neusoft.neu24.service.impl.TbServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/stat")
public class StatController {

    @Autowired
    private AirServiceImpl airService;

    @Autowired
    private StatisticsServiceImpl statisticsService;

    @Autowired
    private TbServiceImpl tbService;


    @GetMapping("/query")
    public CommonResult<StatDTO> query() {

        return statisticsService.query();
    }

    @GetMapping("/load")
    public CommonResult<Integer> load() {
        return airService.load();
    }

    @GetMapping("/load/provinces")
    public CommonResult<Integer> loadProvinces() {
        return airService.loadProvinces();
    }

    @GetMapping("/query/province")
    public CommonResult<List<Province>> queryProvinces() {
        return tbService.queryf();
    }

    @GetMapping("/query/aqi")
    public CommonResult<Aqi2Screen> queryAQI() {
        return tbService.queryAqi();
    }


}